package org.creativor.rayson.transport.server;

import static org.junit.Assert.assertNotNull;
import java.net.Socket;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;
import org.creativor.rayson.transport.server.transfer.TransferConnector;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The class <code>TransferSocketImplTest</code> contains tests for the class
 * <code>{@link TransferSocketImpl}</code>.
 * <p>
 * Copyright Creativor Studio (c) 2011
 * 
 * @generatedBy CodePro at 11-5-7 下午3:26
 * @author Nick Zhang
 * @version $Revision: 1.0 $
 */
public class TransferSocketImplTest {
	/**
	 * Launch the test.
	 * 
	 * @param args
	 *            the command line arguments
	 * 
	 * @generatedBy CodePro at 11-5-7 下午3:26
	 */
	public static void main(String[] args) {
		new org.junit.runner.JUnitCore().run(TransferSocketImplTest.class);
	}

	/**
	 * Perform pre-test initialization.
	 * 
	 * @throws Exception
	 *             if the initialization fails for some reason
	 * 
	 * @generatedBy CodePro at 11-5-7 下午3:26
	 */
	@Before
	public void setUp() throws Exception {
		// TODO: add additional set up code here
	}

	/**
	 * Perform post-test clean-up.
	 * 
	 * @throws Exception
	 *             if the clean-up fails for some reason
	 * 
	 * @generatedBy CodePro at 11-5-7 下午3:26
	 */
	@After
	public void tearDown() throws Exception {
		// TODO: add additional tear down code here
	}

	/**
	 * Run the void close() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 下午3:26
	 */
	@Test(expected = java.net.SocketException.class)
	public void testClose_1() throws Exception {
		TransferSocketImpl fixture = new TransferSocketImpl(
				new ServerStreamConnection(1L, SocketChannel.open(),
						(SelectionKey) null, new ConnectionManager(),
						new TransferConnector("")), new Socket(), (short) 1,
				(short) 1);

		fixture.close();

		// TODO: add additional test code here
	}

	/**
	 * Run the void close() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 下午3:26
	 */
	@Test(expected = java.net.SocketException.class)
	public void testClose_2() throws Exception {
		TransferSocketImpl fixture = new TransferSocketImpl(
				new ServerStreamConnection(1L, SocketChannel.open(),
						(SelectionKey) null, new ConnectionManager(),
						new TransferConnector("")), new Socket(), (short) 1,
				(short) 1);

		fixture.close();

		// TODO: add additional test code here
	}

	/**
	 * Run the void close() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 下午3:26
	 */
	@Test(expected = java.net.SocketException.class)
	public void testClose_3() throws Exception {
		TransferSocketImpl fixture = new TransferSocketImpl(
				new ServerStreamConnection(1L, SocketChannel.open(),
						(SelectionKey) null, new ConnectionManager(),
						new TransferConnector("")), new Socket(), (short) 1,
				(short) 1);

		fixture.close();

		// TODO: add additional test code here
	}

	/**
	 * Run the void close() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 下午3:26
	 */
	@Test(expected = java.net.SocketException.class)
	public void testClose_4() throws Exception {
		TransferSocketImpl fixture = new TransferSocketImpl(
				new ServerStreamConnection(1L, SocketChannel.open(),
						(SelectionKey) null, new ConnectionManager(),
						new TransferConnector("")), new Socket(), (short) 1,
				(short) 1);

		fixture.close();

		// TODO: add additional test code here
	}

	/**
	 * Run the TransferSocketImpl(ServerStreamConnection,Socket,short,short)
	 * constructor test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 下午3:26
	 */
	@Test(expected = java.net.SocketException.class)
	public void testTransferSocketImpl_1() throws Exception {
		ServerStreamConnection connection = new ServerStreamConnection(1L,
				SocketChannel.open(), (SelectionKey) null,
				new ConnectionManager(), new TransferConnector(""));
		Socket socket = new Socket();
		short transfer = (short) 1;
		short clientVersion = (short) 1;

		TransferSocketImpl result = new TransferSocketImpl(connection, socket,
				transfer, clientVersion);

		// TODO: add additional test code here
		assertNotNull(result);
	}
}